package net.larsan.dconf;

import java.util.Properties;

import net.larsan.dconf.util.PropertiesExporter;
import net.larsan.dconf.util.PropertiesImporter;

/**
 * This is  shared interface for components that can import
 * and export their content as properties. 
 * 
 * @author Lars J. Nilsson
 */
public interface PropertiesHandler {

	/**
	 * This method imports a set of properties relative
	 * to the current node. It will overwrite any existing 
	 * properties by default, to change this behavior, please
	 * use {@link PropertiesImporter} directly.
	 * 
	 * @param p Properties to import, must not be null
	 */
	public void importProperties(Properties p);
	
	
	/**
	 * Export this node and all descendants as a properties
	 * set. This will create a return a new properties object, 
	 * to customize this behavior, please use the {@link PropertiesExporter}
	 * as a {@link #visit(DNodeVisitor) visitor}.
	 * 
	 * @return This node and all descendants as properties, never null
	 */
	public Properties exportAsProperties();
	
}
